Skip to content

[GSoC 2026] Add Kafka Streams runner skeleton module + portable entry points - #38521

Closed
junaiddshaukat wants to merge 2 commits into
apache:masterfrom
junaiddshaukat:feat/kafka-streams-runner
Closed

[GSoC 2026] Add Kafka Streams runner skeleton module + portable entry points#38521
junaiddshaukat wants to merge 2 commits into
apache:masterfrom
junaiddshaukat:feat/kafka-streams-runner

Conversation

@junaiddshaukat

Copy link
Copy Markdown
Contributor

Summary

  • Adds new runners/kafka-streams Gradle module and wires it into build/settings.
  • Introduces initial runner surface: KafkaStreamsRunner, options, registrar, job server driver, job invoker, and translation context.
  • Adds stub translator behavior that fails clearly with No translator registered for URN ... for unsupported transforms.
  • Updates CHANGES.md with the new runner skeleton entry.

Validation

  • ./gradlew :runners:kafka-streams:compileJava
  • ./gradlew :runners:kafka-streams:check

Scope

This PR intentionally provides skeleton plumbing only.
No transform translators, watermark manager, or state implementation are included yet.

Closes #38465

cc @je-ik


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request establishes the foundational skeleton for a new Kafka Streams runner in Apache Beam. It sets up the necessary project structure, build configurations, and core portable runner entry points. The implementation currently focuses on plumbing, ensuring that the runner can be registered and invoked, while providing a fail-fast mechanism for pipeline translation until specific transform support is added.

Highlights

  • New Gradle Module: Introduced the runners/kafka-streams module and integrated it into the build system and settings.
  • Runner Surface Area: Implemented the initial Kafka Streams runner infrastructure, including KafkaStreamsRunner, pipeline options, registrar, job server driver, and job invoker.
  • Stub Translation Logic: Added a skeleton translator that provides clear error messaging for unsupported transforms, serving as a foundation for future implementation.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new runners/kafka-streams Gradle module providing a portable job server and runner entry points for Apache Kafka Streams. The implementation includes a job invoker, server driver, and a pipeline translator that currently performs validation and fails fast for unsupported transforms. Feedback focuses on improving the robustness of the KafkaStreamsPipelineResult by ensuring the job server is only stopped upon reaching a terminal state or through a finally block to handle exceptions during cancellation and completion. Additionally, it is suggested to include the job name in the default state directory path to avoid conflicts during parallel execution.

Comment on lines +52 to +56
public State waitUntilFinish(Duration duration) {
State state = delegate.waitUntilFinish(duration);
stopJobServer.run();
return state;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current implementation stops the job server even if waitUntilFinish(duration) times out and the pipeline is still running. This prevents further interaction with the job. The server should only be stopped if the pipeline has reached a terminal state.

  @Override
  public State waitUntilFinish(Duration duration) {
    State state = delegate.waitUntilFinish(duration);
    if (state != null && state.isTerminal()) {
      stopJobServer.run();
    }
    return state;
  }

class StateDirDefaultFactory implements DefaultValueFactory<String> {
@Override
public String create(PipelineOptions options) {
return Paths.get(System.getProperty("java.io.tmpdir"), "beam-kafka-streams-state").toString();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a fixed path for the Kafka Streams state directory in the system temp directory can cause conflicts and LockException when multiple pipelines (e.g., parallel tests) run on the same host. It is recommended to include the job name to ensure uniqueness.

Suggested change
return Paths.get(System.getProperty("java.io.tmpdir"), "beam-kafka-streams-state").toString();
return Paths.get(System.getProperty("java.io.tmpdir"), "beam-kafka-streams-state", options.getJobName()).toString();

Comment on lines +45 to +49
public State cancel() throws IOException {
State state = delegate.cancel();
stopJobServer.run();
return state;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The job server should be stopped even if cancel() throws an IOException to ensure resources are released. Using a try-finally block is recommended.

  @Override
  public State cancel() throws IOException {
    try {
      return delegate.cancel();
    } finally {
      stopJobServer.run();
    }
  }

Comment on lines +59 to +63
public State waitUntilFinish() {
State state = delegate.waitUntilFinish();
stopJobServer.run();
return state;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is safer to stop the job server in a finally block to ensure cleanup even if waitUntilFinish() throws an exception (e.g., due to communication issues with the server).

  @Override
  public State waitUntilFinish() {
    try {
      return delegate.waitUntilFinish();
    } finally {
      stopJobServer.run();
    }
  }

@junaiddshaukat junaiddshaukat changed the title GSoC 2026] Add Kafka Streams runner skeleton module + portable entry points [GSoC 2026] Add Kafka Streams runner skeleton module + portable entry points May 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @shunping added as fallback since no labels match configuration

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@je-ik

je-ik commented May 17, 2026

Copy link
Copy Markdown
Contributor

@junaiddshaukat I will walk through the PR ASAP, but can you please change the target branch? We don't want this subtask to hit master branck right now. Thanks!

@junaiddshaukat

Copy link
Copy Markdown
Contributor Author

@junaiddshaukat I will walk through the PR ASAP, but can you please change the target branch? We don't want this subtask to hit master branck right now. Thanks!

@je-ik sure, changing it right now

@junaiddshaukat

Copy link
Copy Markdown
Contributor Author

Moving review to fork PR per my mentor (@je-ik) guidance: junaiddshaukat#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GSoC 2026] Kafka Streams Runner — skeleton Gradle module + pipeline entry points

2 participants